forked from
quillmatiq.com/augment
Fork of Chiri for Astro for my blog
1---
2import { type CollectionEntry, getCollection } from 'astro:content'
3import PostLayout from '@/layouts/PostLayout.astro'
4import { render } from 'astro:content'
5
6export async function getStaticPaths() {
7 const posts = await getCollection('posts')
8 return posts
9 .filter((post) => !post.id.startsWith('_'))
10 .map((post) => ({
11 params: { slug: post.id },
12 props: post
13 }))
14}
15type Props = CollectionEntry<'posts'>
16
17const post = Astro.props
18const { Content, remarkPluginFrontmatter } = await render(post)
19
20const readingTime = remarkPluginFrontmatter.readingTime
21const toc = remarkPluginFrontmatter.toc || []
22---
23
24<PostLayout {...post.data} readingTime={readingTime} toc={toc}>
25 <Content />
26</PostLayout>